#define BPF_NO_GLOBAL_DATA
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>

// #define SEC(NAME) __attribute__((section(NAME), used))
typedef unsigned int u32;
typedef int pid_t;
// 只能定义 const 变量
const pid_t pid_filter = 0;
const int count = 0x1;



// perf list | grep syscall 
// raw_syscalls:sys_enter
SEC("tracepoint/spi/spi_message_done")
int bpf_prog(void *ctx) {
  int c = 0x0;
  const char fmt_str[] = "Hello, world, from BPF! My PID is %d\n";
  const char fmt_str_count[] = "Hello, world, from BPF! count is %d\n";
  const char msg[] = "Hello, BPF World!\n";
  pid_t pid;
  
  pid = bpf_get_current_pid_tgid() >> 32;
  

  bpf_trace_printk(msg, sizeof(msg));
  bpf_trace_printk(fmt_str, sizeof(fmt_str), pid);
  bpf_trace_printk(fmt_str_count, sizeof(fmt_str_count), count);

  return 0;
}

char _license[] SEC("license") = "GPL";
